package org.nf.shopping.controller;

import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.nf.shopping.common.vo.ResultVO;
import org.nf.shopping.entity.Detailsr;
import org.nf.shopping.service.DetailsrService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author czl
 * @Date 2024-12-19
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/detailsr")
public class DetailsrController extends BaseController{

    private final DetailsrService detailsrService;

    @GetMapping("/listDetailsr")
    public ResultVO<PageInfo<Detailsr>> listDetailsr(Integer limit, Integer page, Integer id){
        PageInfo<Detailsr> pageInfo = detailsrService.listDetailsr(limit, page, id);
        return success(pageInfo);
    }

    @PostMapping("/updateDetailsr")
    public ResultVO updateDetailsr(Detailsr detailsr){
        detailsrService.updateDetailsr(detailsr);
        return success();
    }

    @PostMapping("/deloneDetailsr")
    public ResultVO deloneDetailsr(Integer id){
        detailsrService.deloneDetailsr(id);
        return success();
    }

    @PostMapping("/addDetailsr")
    public ResultVO addDetailsr(Detailsr detailsr){
        detailsrService.addDetailsr(detailsr);
        return success();
    }

    @PostMapping("/getDetailsrList")
    public ResultVO<List<Detailsr>> getDetailsrList(){
        return success(detailsrService.getDetailsrList());
    }
}
